home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / advancec.arc / UIS.ARC / DEFS.H next >
Text File  |  1992-01-24  |  4KB  |  214 lines

  1. /*
  2.     defs.h
  3.  
  4.     segment, key, primitive, and attribute declarations
  5. */
  6.  
  7. #define NULL 0
  8.  
  9. #define BOOLEAN int
  10. #define TRUE 1
  11. #define FALSE  0
  12.  
  13. #define BIG  (60*1024)
  14. #define NBIG (-BIG)
  15.  
  16. char     *malloc(), *calloc();
  17. #define MALLOC(x)   ((x *) malloc(sizeof(x)))
  18. #define CALLOC(n,x) ((x *) calloc(n,sizeof(x)))
  19.  
  20. struct  point_primitive
  21.     {
  22.     int x, y;
  23.     };
  24.  
  25. typedef struct  point_primitive point_t;
  26. point_t *inst_point();
  27.  
  28. struct  rect_primitive
  29.     {
  30.     int left, bottom, right, top;
  31.     };
  32.  
  33. typedef struct  rect_primitive  rect_t;
  34. rect_t  *inst_rect();
  35.  
  36. struct  cont_point
  37.     {
  38.     point_t point;
  39.     struct  cont_point  *next;
  40.     };
  41.  
  42. typedef struct  cont_point  cpoint_t;
  43.  
  44. struct  line_primitive
  45.     {
  46.     int     num_points;
  47.     rect_t  *bbox;
  48.     struct  cont_point  *point;
  49.     };
  50.  
  51. typedef struct  line_primitive  line_t;
  52. line_t  *inst_line();
  53. line_t  *close_line();
  54.  
  55. struct  poly_primitive
  56.     {
  57.     int     num_points;
  58.     rect_t  *bbox;
  59.     struct  cont_point  *point;
  60.     };
  61.  
  62. typedef struct  poly_primitive  poly_t;
  63. poly_t  *inst_poly();
  64. poly_t  *close_poly();
  65.  
  66. #define oval_t  rect_t
  67. #define inst_oval   inst_rect
  68.  
  69. /*
  70.     text justification definitions
  71. */
  72.  
  73. #define TOP     't'
  74. #define CENTER  'c'
  75. #define BOTTOM  'b'
  76. #define LEFT    'l'
  77. #define MIDDLE  'm'
  78. #define RIGHT   'r'
  79. #define TXTSZE  32
  80.  
  81. struct  text_primitive
  82.     {
  83.     point_t origin;
  84.     rect_t  *bbox;
  85.     char    just[2];    /* justification */
  86.     char    text[TXTSZE];
  87.     };
  88.  
  89. typedef struct  text_primitive  text_t;
  90. text_t  *inst_text();
  91.  
  92. struct  reference
  93.     {
  94.     point_t origin;
  95.     struct  segment *instance;
  96.     char    name[TXTSZE];
  97.     };
  98.  
  99. typedef struct  reference   ref_t;
  100. ref_t   *inst_ref();
  101.  
  102. /*
  103.     key primitive types
  104. */
  105.  
  106. #define POINT   1
  107. #define LINE    2
  108. #define RECT    3
  109. #define POLY    4
  110. #define OVAL    5
  111. #define TEXT    6
  112. #define REF     7
  113. #define ISPRIM(x)   ((x) < 8 ? TRUE : FALSE)
  114.  
  115. struct  seg_key
  116.     {
  117.     int type;
  118.     union
  119.         {
  120.         char    *ptr;
  121.         point_t *point;
  122.         line_t  *line;
  123.         rect_t  *rect;
  124.         poly_t  *poly;
  125.         oval_t  *oval;
  126.         text_t  *text;
  127.         ref_t   *ref;
  128.         }   key;
  129.     struct  seg_key *next;
  130.     };
  131.  
  132. typedef struct  seg_key key_t;
  133. key_t   *inst_key();
  134.  
  135. /*
  136.     dynamic segment construction macros
  137. */
  138.  
  139. #define add_attr(a)     append(a,NULL)
  140. #define add_point(p)    append(POINT,p)
  141. #define add_line(l)     append(LINE,l)
  142. #define add_rect(r)     append(RECT,r)
  143. #define add_poly(p)     append(POLY,p)
  144. #define add_oval(o)     append(OVAL,o)
  145. #define add_text(t)     append(TEXT,t)
  146. #define add_ref(r)      append(REF,r)
  147.  
  148. /*
  149.     attribute definitions
  150. */
  151.  
  152. #define RESET   99
  153.  
  154. #define COPY    10
  155. #define XOR     11
  156.  
  157. #define FILL    12
  158. #define NOFILL  13
  159. #define FRAME   14
  160. #define NOFRAME 15
  161.  
  162. #define BLACK   20
  163. #define RED     21
  164. #define GREEN   22
  165. #define BLUE    23
  166. #define CYAN    24
  167. #define MAGENTA 25
  168. #define YELLOW  26
  169. #define WHITE   27
  170.  
  171. #define ISATTR(x)   ((x) >= 10 ? TRUE : FALSE)
  172.  
  173. /*
  174.     segment descriptor
  175. */
  176.  
  177. struct  segment
  178.     {
  179.     int num_inst, visible, locked;
  180.     char    *name;
  181.     rect_t  *bbox;
  182.     key_t   *data,
  183.             *eol;
  184.     struct  segment *next;
  185.     };
  186.  
  187. typedef struct  segment seg_t;
  188. seg_t   *cl_seg();  /* close segment */
  189.  
  190. /*
  191.     viewport descriptor
  192. */
  193.  
  194. struct  viewport
  195.     {
  196.     rect_t  *bitmap,
  197.             *window;
  198.     int     brder, bkgnd;   /* colors */
  199.     seg_t   *seg;
  200.     };
  201. typedef struct  viewport    vport_t;
  202.  
  203. /*
  204.     metafile key
  205. */
  206.  
  207. struct    diskkey
  208.     {
  209.     int type;
  210.     int size;
  211.     };
  212. typedef    struct    diskkey    disk_key_t;
  213.  
  214.